package cn.wolfcode.springcloud.feign.hystrix;

import cn.wolfcode.springcloud.domain.Product;
import cn.wolfcode.springcloud.feign.IProductFeignApi;
import org.springframework.stereotype.Component;
//贴@Component交给spring容器管理
@Component
//实现IProductFeignApi是为了指定哪些地方需要做降级处理
//该类用于product-server服务对外提供接口进行降级保护
public class ProductFeignHystrix implements IProductFeignApi{
    //IProductFeignApi中get方法的降级方法
    @Override
    public Product get(Long id) {
        System.out.println("走降级方法了。。ProductFeignHystrix。。");
        Product product = new Product();
        product.setName("降级方法:默认对象");

        return product;
    }
}